//
//  GYHomeMarketPriceVC.m
//  GYDemo
//
//  Created by Mrzhang on 2018/4/2.
//  Copyright © 2018年 mac. All rights reserved.
//

//
//                .-~~~~~~~~~-._       _.-~~~~~~~~~-.
//            __.'              ~.   .~              `.__
//          .'//                  \./                  \\`.
//        .'//                     |                     \\`.
//      .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \\`.
//    .'//.-"                 `-.  |  .-'                 "-.\\`.
//  .'//______.============-..   \ | /   ..-============.______\\`.
//.'______________________________\|/______________________________`.
//
//

#import "GYHomeMarketPriceVC.h"
#import "NBLScrollTabController.h"
#import "Head.h"
#import "GYPriceListVC.h"
#import "GYMarketListModel.h"
@interface GYHomeMarketPriceVC ()<NBLScrollTabControllerDelegate>
@property (nonatomic, strong) NBLScrollTabController *scrollTabController;
@property (nonatomic, strong) NSArray *viewControllers;
@property (nonatomic, copy) NSArray *datas;
@end

@implementation GYHomeMarketPriceVC
#pragma mark - getter and setter
#pragma mark - event
#pragma mark - method
#pragma mark - life


- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"市场价格";
    self.view.backgroundColor=[UIColor whiteColor];
   // self.edgesForExtendedLayout = UIRectEdgeNone;
    
    NSMutableArray *viewCtrs = [[NSMutableArray alloc] init];
    
   // @WeakSelf;
    NSString *interface = @"marketPrice";
    
    [[InterfaceManager shareInterface]requetInterface:interface withParameter:nil handler:^(NSDictionary *info, InterfaceStatusModel *infoModel) {
        NSArray *datalist = infoModel.data;
        if ([datalist isKindOfClass:[NSArray class]]) {
            for (NSDictionary *dic in datalist) {
                GYMarketListModel *model = [GYMarketListModel yy_modelWithJSON:dic];
                
                GYPriceListVC *contentCtr = [[GYPriceListVC alloc] init];
                contentCtr.datas = model.list;
                NBLScrollTabItem *contentItem = [[NBLScrollTabItem alloc] init];
                contentItem.title = model.marketname;
                contentItem.hideBadge = YES;//每个title可以做个性化配置
                contentItem.font = [UIFont systemFontOfSize:15];
                contentCtr.tabItem = contentItem;
                [viewCtrs addObject:contentCtr];
      
            }

            _viewControllers = viewCtrs;
            
            NBLScrollTabTheme *theme = [[NBLScrollTabTheme alloc] init];
            theme.titleViewBGColor = Main_Color_Red;
            theme.titleColor = RGBACOLOR(255, 255, 255, 0.7);
            theme.highlightColor = [UIColor whiteColor];
            theme.indicatorViewColor = [UIColor clearColor];
            _scrollTabController = [[NBLScrollTabController alloc] initWithTabTheme:theme];
            _scrollTabController.view.frame = self.view.bounds;
            _scrollTabController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
            _scrollTabController.delegate = self;
            _scrollTabController.viewControllers = self.viewControllers;
            
            [self.view addSubview:self.scrollTabController.view];
        }
        
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - NBLScrollTabControllerDelegate
- (void)tabController:(NBLScrollTabController * __nonnull)tabController didSelectViewController:(UIViewController * __nonnull)viewController {
    //业务逻辑处理
}
- (void)tabController:(NBLScrollTabController *)tabController didSelectIndex:(NSInteger)index {
    NSLog(@"点击了:%ld", index);
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
#pragma mark - delegate
@end


/*
 11111111111111111111111111111111111111001111111111111111111111111
 11111111111111111111111111111111111100011111111111111111111111111
 11111111111111111111111111111111100001111111111111111111111111111
 11111111111111111111111111111110000111111111111111111111111111111
 11111111111111111111111111111000000111111111111111111111111111111
 11111111111111111111111111100000011110001100000000000000011111111
 11111111111111111100000000000000000000000000000000011111111111111
 11111111111111110111000000000000000000000000000011111111111111111
 11111111111111111111111000000000000000000000000000000000111111111
 11111111111111111110000000000000000000000000000000111111111111111
 11111111111111111100011100000000000000000000000000000111111111111
 11111111111111100000110000000000011000000000000000000011111111111
 11111111111111000000000000000100111100000000000001100000111111111
 11111111110000000000000000001110111110000000000000111000011111111
 11111111000000000000000000011111111100000000000000011110001111111
 11111110000000011111111111111111111100000000000000001111100111111
 11111111000001111111111111111111110000000000000000001111111111111
 11111111110111111111111111111100000000000000000000000111111111111
 11111111111111110000000000000000000000000000000000000111111111111
 11111111111111111100000000000000000000000000001100000111111111111
 11111111111111000000000000000000000000000000111100000111111111111
 11111111111000000000000000000000000000000001111110000111111111111
 11111111100000000000000000000000000000001111111110000111111111111
 11111110000000000000000000000000000000111111111110000111111111111
 11111100000000000000000001110000001111111111111110001111111111111
 11111000000000000000011111111111111111111111111110011111111111111
 11110000000000000001111111111111111100111111111111111111111111111
 11100000000000000011111111111111111111100001111111111111111111111
 11100000000001000111111111111111111111111000001111111111111111111
 11000000000001100111111111111111111111111110000000111111111111111
 11000000000000111011111111111100011111000011100000001111111111111
 11000000000000011111111111111111000111110000000000000011111111111
 11000000000000000011111111111111000000000000000000000000111111111
 11001000000000000000001111111110000000000000000000000000001111111
 11100110000000000001111111110000000000000000111000000000000111111
 11110110000000000000000000000000000000000111111111110000000011111
 11111110000000000000000000000000000000001111111111111100000001111
 11111110000010000000000000000001100000000111011111111110000001111
 11111111000111110000000000000111110000000000111111111110110000111
 11111110001111111100010000000001111100000111111111111111110000111
 11111110001111111111111110000000111111100000000111111111111000111
 11111111001111111111111111111000000111111111111111111111111100011
 11111111101111111111111111111110000111111111111111111111111001111
 11111111111111111111111111111110001111111111111111111111100111111
 11111111111111111111111111111111001111111111111111111111001111111
 11111111111111111111111111111111100111111111111111111111111111111
 11111111111111111111111111111111110111111111111111111111111111111
 
 
 */
